﻿/*----------------------------------------------------------------
// Copyright (C) 2011 上海
// 版权所有。 
//
// 文件名：DataAccessWarehouseSummaryNew
// 文件功能描述：盈亏报表数据访问层
//
// 
// 创建标识：2012-06-04 王冲
//
// 修改标识：
// 修改描述：
//
//
//----------------------------------------------------------------*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using DbAdapter.sqldbAdapter;
using System.Data.SqlClient;

namespace DAO.WaiGaoQiao
{
    public class DataAccessWarehouseSummaryNew
    {
        /// <summary>
        /// 获取班组列表（用于绑定下拉框）
        /// </summary>
        /// <returns></returns>
        public DataSet GetGroup()
        {
            using (SqlConnection conn = new SqlConnection(GetConntionString.conntionstring()))
            {
                sqldb db = new sqldb();
                string query = "select ID,Group_Name from Con_Group order by ID";
                DataSet ds = db.ExecuteDataset(conn, CommandType.Text, query);
                return ds;
            }
        }

        public DataSet GetList(string yy, string mm, string group_id)
        {
            sqldb db = new sqldb();
            SqlParameter[] parameters = {
                    new SqlParameter("@yy", SqlDbType.Int),
                    new SqlParameter("@mm",SqlDbType.Int),
                    new SqlParameter("@Group_ID", SqlDbType.Int),
                    new SqlParameter("@startpage", SqlDbType.Int),
					new SqlParameter("@endpage",SqlDbType.Int)
                    };
            parameters[0].Value = yy;
            parameters[1].Value = mm;
            parameters[2].Value = group_id;
            parameters[3].Value = 0;
            parameters[4].Value = 0;
            DataSet ds = db.ExecuteDataset(GetConntionString.conntionstring(), CommandType.StoredProcedure, "Proc_Group_profitandloss", parameters);
            return ds;
        }

        public DataSet GetListWarehouseSummary(string yy, string mm, string node_id)
        {
            sqldb db = new sqldb();
            SqlParameter[] parameters = {
                    new SqlParameter("@yy", SqlDbType.Int),
                    new SqlParameter("@mm",SqlDbType.Int),
                    new SqlParameter("@NODE_ID", SqlDbType.Int),
                    new SqlParameter("@startpage", SqlDbType.Int),
					new SqlParameter("@endpage",SqlDbType.Int)
                    };
            parameters[0].Value = yy;
            parameters[1].Value = mm;
            parameters[2].Value = node_id;
            parameters[3].Value = 0;
            parameters[4].Value = 0;
            DataSet ds = db.ExecuteDataset(GetConntionString.conntionstring(), CommandType.StoredProcedure, "Proc_Dining_Warehouse_Collect", parameters);
            return ds;
        }

        public DataSet GetInOutWarehouseDetail(string yy, string mm, string shitang, string leixing)
        {
            sqldb db = new sqldb();
            SqlParameter[] parameters = {
                    new SqlParameter("@yy", SqlDbType.Int),
                    new SqlParameter("@mm",SqlDbType.Int),
                    new SqlParameter("@NODE_ID", SqlDbType.Int),
                    new SqlParameter("@GOODS_BIGTYPE", SqlDbType.VarChar,50),
                    new SqlParameter("@startpage", SqlDbType.Int),
					new SqlParameter("@endpage",SqlDbType.Int)
                    };
            parameters[0].Value = yy;
            parameters[1].Value = mm;
            parameters[2].Value = shitang;
            parameters[3].Value = leixing;
            parameters[4].Value = 0;
            parameters[5].Value = 0;
            DataSet ds = db.ExecuteDataset(GetConntionString.conntionstring(), CommandType.StoredProcedure, "Proc_Dining_InOut_Detail", parameters);
            return ds;
        }

        public DataSet GetCostAccount(int yy, int mm, int GID)
        {
            sqldb db = new sqldb();
            string query = "Execute PROC_YingKuiAll " + yy + "," + mm + "," + GID.ToString();
            DataSet ds = db.ExecuteDataset(GetConntionString.conntionstring(), CommandType.Text, query);
            return ds;
        }
    }
}
